﻿@model prav.Models.ShowPostViewModel

@section scripts {
    <script type="text/javascript"
            src="@Url.Content(
"~/scripts/jquery.unobtrusive-ajax.js")">
    </script>
}


<div class="postShow">
    <div class="authorStyle">
        <b>@Model.Post.Author.UserName</b>
    </div>
    <div style="float: left">
        <h1 class="postHeader">@Model.Post.Header</h1>
        <div class="bodyStyle" style="max-height: 100%;">@Model.Post.Body</div>
    </div>
</div>

<h2 style="background-color: #F4F4F4; text-align: center">Коментарии</h2>

@Ajax.ActionLink("Написать коментарий", "New" , new { parentId = Model.Post.Id},
        new AjaxOptions { InsertionMode = InsertionMode.Replace, UpdateTargetId = "addCommentForm" },
        new { @class = "btn btn-primary btn-large", @style ="width: 100%"})
<div id="addCommentForm"></div>

@foreach (var comment in Model.Post.Comments)
{
    <div>
        <div class="postShow">
            <div class="authorStyle">
                <b>@comment.Author.UserName</b>
            </div>
            <div style="float: left">
                <h1 class="postHeader">@comment.Header</h1>
                <div class="bodyStyle" style="max-height: 100%;">@comment.Body</div>
            </div>
        </div>
    </div>
}

